<template>
	<view>
		<image :src="goodInfo.url"></image>
		<view>
			<view class="goods-title text-line-hide">{{goodInfo.name}}</view>
		</view>
		
		<view>
			<view>
			 	<button type="warn" @click="storeUserPrize">帮抽</button>
			</view>
		</view>
		<auth/>
	</view>
</template>

<script>
import auth from "@/components/authorization/index.vue"
import {getLotteryInfoById,storeHelpUserPrize} from "../../service/base.js"
	export default {
		components: {
			auth
		},
		data() {
			return {
		      //商品对象
			  goodInfo:{},
			  token: null,
			  lotteryId: null
			}
		},
		onLoad(options) {
		  //获取商品信息
	     this.token = options.token 
		 this.lotteryId = options.lotteryId|1
		 this.getLotteryInfoById()
		},
		methods: {
		   getLotteryInfoById() {
			  getLotteryInfoById({id:this.lotteryId}).then(res => {
				  this.goodInfo = res.data
			  })  
		   },
		   //开始抽奖
		   storeUserPrize() {
		   	    storeHelpUserPrize({"lottery_id":this.goodInfo.id,"token":this.token}).then((res) =>{
		   			// this.code = res.data.code
					console.lg(res)
		     	})
		   }
		},
	}
</script>

<style>
    image {
		width: 100%;
		height: 200px;
	}  
	.title {
		width: 50px;
		height: 50px;
	}
</style>
